How to console.log data from an API call in this situation